﻿using Magicodes.ExporterAndImporter.Excel.AspNetCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NP.BPMReportPlatform.StandardApprovalFlow.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.StandardApprovalFlow
{
    /// <summary>
    /// 船舶特殊订单流程 CB-TSDD
    /// </summary>
    [Authorize]
    [ApiController]
    [Route("api/CommmonApproval")]
    public class CBTSDDController : BPMReportPlatformController
    {
        private readonly ICBTSDDService _cBTSDDService;
        public CBTSDDController(ICBTSDDService cBTSDDService)
        {
            _cBTSDDService = cBTSDDService;
        }

        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("CBTSDD/GetAllAsync")]
        public async Task<PagedResultDto<CBTSDDOutput>> GetAllAsync([FromBody] CBTSDDInput input)
        {
            return await _cBTSDDService.GetAllAsync(input);
        }

        /// <summary>
        /// 导出数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("CBTSDD/ExportAsync")]
        public async Task<XlsxFileResult<CBTSDDOutput>> ExportAsync([FromBody] CBTSDDInput input)
        {
            var rst = await _cBTSDDService.ExportAsync(input);
            return new XlsxFileResult<CBTSDDOutput>(rst, "导出Excel");
        }
    }
}
